# https://rpic.douyucdn.cn/live-cover/appCovers/2020/10/25/9235572_20201025005556_small.jpg

import requests
from timeit import default_timer as timer

# url路径
url = 'https://rpic.douyucdn.cn/live-cover/appCovers/2020/10/25/9235572_20201025005556_small.jpg'

# get的stream默认为False  直接下载
img = requests.get(url,stream = True)

# 测试运行时间
tic = timer()

with open('dy_girl.jpg','wb') as jpg:
    print('开始下载')
    value = img.iter_content(chunk_size=1024 * 1024)
    for chunk in value:
        if chunk:
            jpg.write(chunk)
            print(chunk)
    print(value)
print('停止下载')

# 测试运行时间
toc = timer()
print(toc - tic) # 输出的时间，秒为单位0